﻿@model List<TestHttpModules.User>
@using (Ajax.BeginForm("DeleteMore", new AjaxOptions
         {
             HttpMethod = "Post",
             OnSuccess = "DelAfter",
             OnBegin = "DelBefore",
             UpdateTargetId = "list",
         }))
{
    <div class="OperatePanel">
        @Html.ActionLink("插入列表", "CreateList")
        @Html.ActionLink("编辑列表", "EditList")
        @Html.ActionLink("建立", "Create")
        <button>
            批量删除</button>
    </div>
    <fieldset>
        <legend>实体列表</legend>
        <table>
            <thead>
                <tr>
                    <td>
                        编号
                    </td>
                    <td>
                        真实姓名
                    </td>
                    <td>
                        状态
                    </td>
                    <td>
                        账号
                    </td>
                    <td>
                    </td>
                </tr>
            </thead>
            <tbody >
                @foreach (var item in Model)
                { 
                    <tr>
                        <td>
                            <input type="checkbox" name="ID" value="@item.ID" />
                            @item.ID
                        </td>
                        <td>
                            @(item.User_Profile == null ? "没有设定" : item.User_Profile.RealName)
                            @*　这样写多查很多查库呀,如果用延时加载的话，自己写linq当然是没问题的 *@
                            @if (item.Product != null && item.Product.Count() > 0)
                            {
                                foreach (var p in item.Product)
                                { 
                                <p>@p.Name</p>
                                }
                            }
                        </td>
                        <td>
                            @((Commons.Entity.CommonEnums.Status)item.Status)
                        </td>
                        <td>
                            @item.Name
                        </td>
                        <td>
                            [@Html.ActionLink("编辑", "Edit", new { id = item.ID })] [@Html.ActionLink("删除", "Del", new { id = item.ID })]
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </fieldset>
}
<script type="text/javascript">
    $("#list>tr").filter(":odd").attr("style", "background:#eeeeee;");
</script>
